package org.activequant.dao.hibernate.config;

import org.activequant.dao.IAccountDao;
import org.activequant.dao.IBalanceBookDao;
import org.activequant.dao.IBrokerAccountDao;
import org.activequant.dao.ICandleDao;
import org.activequant.dao.IMarketDepthEventDao;
import org.activequant.dao.IMarketScanDao;
import org.activequant.dao.IOrderBookDao;
import org.activequant.dao.IOrderDao;
import org.activequant.dao.IPortfolioDao;
import org.activequant.dao.IPositionDao;
import org.activequant.dao.IQuoteDao;
import org.activequant.dao.IScanCriteriaDao;
import org.activequant.dao.ISpecificationDao;
import org.activequant.dao.ISpecificationDetailsDao;
import org.activequant.dao.ITickerNewsDao;
import org.activequant.dao.ITradeIndicationDao;
import org.activequant.dao.hibernate.AccountDao;
import org.activequant.dao.hibernate.BalanceBookDao;
import org.activequant.dao.hibernate.BrokerAccountDao;
import org.activequant.dao.hibernate.CandleDao;
import org.activequant.dao.hibernate.MarketDepthEventDao;
import org.activequant.dao.hibernate.MarketScanDao;
import org.activequant.dao.hibernate.OrderBookDao;
import org.activequant.dao.hibernate.OrderDao;
import org.activequant.dao.hibernate.PortfolioDao;
import org.activequant.dao.hibernate.PositionDao;
import org.activequant.dao.hibernate.QuoteDao;
import org.activequant.dao.hibernate.ScanCriteriaDao;
import org.activequant.dao.hibernate.SpecificationDao;
import org.activequant.dao.hibernate.SpecificationDetailsDao;
import org.activequant.dao.hibernate.TickerNewsDao;
import org.activequant.dao.hibernate.TradeIndicationDao;
import org.hibernate.SessionFactory;
import org.springframework.config.java.annotation.Bean;
import org.springframework.config.java.annotation.Configuration;
import org.springframework.config.java.annotation.ExternalBean;
/**
 * An abstract class. Annotated with:<br/>
 * <strong>@Configuration</strong>
 * @author Dimitar
 *
 */
@Configuration
public abstract class HibernateDaoConfig {
	
	@ExternalBean
	abstract SessionFactory sessionFactory();
	
	@Bean
	public IAccountDao accountDao() {
		return new AccountDao(sessionFactory());
	}
	
	@Bean
	public IBrokerAccountDao brokerAccountDao() {
		return new BrokerAccountDao(sessionFactory());
	}
	
	@Bean
	public IOrderDao orderDao() {
		return new OrderDao(sessionFactory());
	}
	
	@Bean
	public IOrderBookDao orderBookDao() {
		return new OrderBookDao(sessionFactory());
	}
	
	@Bean
	public IPortfolioDao portfolioDao() {
		return new PortfolioDao(sessionFactory());
	}
	
	@Bean
	public IPositionDao positionDao() {
		return new PositionDao(sessionFactory());
	}
	
	@Bean
	public IBalanceBookDao balanceBookDao() {
		return new BalanceBookDao(sessionFactory());
	}
	
	@Bean
	public ITradeIndicationDao tradeIndicationDao() {
		return new TradeIndicationDao(sessionFactory());
	}
	
//	@Bean
//	public IMarketDepthDao marketDepthDao() {
//		return new MarketDepthDao(sessionFactory());
//	}
	
	@Bean
	public IMarketDepthEventDao marketDepthEventDao() {
		return new MarketDepthEventDao(sessionFactory());
	}
	
	@Bean
	public ICandleDao candleDao() {
		return new CandleDao(sessionFactory());
	}

	@Bean
	public IQuoteDao quoteDao() {
		return new QuoteDao(sessionFactory());
	}

	@Bean
	public ISpecificationDao specificationDao() {
		return new SpecificationDao(sessionFactory());
	}
	
	@Bean
	public ISpecificationDetailsDao specificationDetailsDao() {
		return new SpecificationDetailsDao(sessionFactory());
	}
	
	@Bean
	public IScanCriteriaDao scanCriteriaDao() {
		return new ScanCriteriaDao(sessionFactory());
	}
		
	@Bean
	public IMarketScanDao marketScanDao() {
		return new MarketScanDao(sessionFactory());
	}
	
	@Bean
	public ITickerNewsDao tickerNewsDao() {
		return new TickerNewsDao(sessionFactory());
	}
}
